<template>
    <div id="map-location"></div>
</template>

<script>
    export default {
        props:{
            showbol:Boolean
        },
        data() {
            return {
                
            }
        },
        watch: {
            showbol(newName, oldName){
                this.mapinit()
                
            },
        },
        mounted(){

            this.mapinit()
        },              
        methods: {
               mapinit(){
                // center: [120.217373,30.247152], //初始地图中心点
                var map = new BMap.Map("map-location");
                map.centerAndZoom(new BMap.Point(120.217373,30.247152), 18);
                var point = new BMap.Point(120.217373,30.247152);
                // map.centerAndZoom(point, 12);
                var marker = new BMap.Marker(point);  // 创建标注
                map.addOverlay(marker);               // 将标注添加到地图中
                marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画   
                map.enableScrollWheelZoom(true);        
            },           
        }
    }
</script>

<style scoped>
    #map-location{
        width: 920px;
        height: 300px;
        margin: 30px auto 0 auto;
        border-radius: 5px;
   }  
</style>